package com.huonan.jb.tools.hdfsuse;

import com.huonan.utils.HDFSUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.hadoop.fs.FileStatus;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Slf4j
public class HdfsHandler {
    public static void main(String[] args) {
        String filePath= CommandArgs.getArgs(args);
        log.info(filePath);
        FileStatus[] listHdfsFile = HDFSUtil.listHdfsFile(filePath);
        List<String> pathList = Arrays.stream(listHdfsFile)
                .map(f -> f.getPath().getName())
                .collect(Collectors.toList());
        String localDir = CommandArgs.getOptionValue(args, "local_dir");
        log.info(localDir);
        for (String file : pathList) {
            log.info(file);
        }
    }
}
